package com.example.server.common.config.pay;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author china.fuyao@outlook.com
 * @date 2020-04-17 14:14
 */
@Configuration
public class WXPayConfig {
    //应用编号
    public static String appId;
    //appSecret 是 appId 对应的接口密码，微信公众号授权获取用户 openId 时使用
    public static String appSecret;
    //微信支付商户号
    public static String mchId;
    //API 密钥，微信商户后台配置
    public static String partnerKey;
    //apiclient_cert.p1 证书路径，在微信商户后台下载
    public static String certPath;
    //外网访问项目的域名，支付通知中会使用
    public static String domain;

    @Value("${pay.wxpay.appId}")
    private void setAppId(String appId) {
        this.appId = appId;
    }

    @Value("${pay.wxpay.appSecret}")
    private void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    @Value("${pay.wxpay.mchId}")
    private void setMchId(String mchId) {
        this.mchId = mchId;
    }

    @Value("${pay.wxpay.partnerKey}")
    private void setPartnerKey(String partnerKey) {
        this.partnerKey = partnerKey;
    }

    @Value("${pay.wxpay.certPath}")
    private void setCertPath(String certPath) {
        this.certPath = certPath;
    }

    @Value("${pay.wxpay.domain}")
    private void setDomain(String domain) {
        this.domain = domain;
    }
}
